algalcommand.script
Class ScriptManager

java.lang.Object
  extended by algalcommand.script.ScriptManager
All Implemented Interfaces:
PBRDataListener

public class ScriptManager
extends java.lang.Object
implements PBRDataListener

The ScriptManager class is the master controller for Pbotobioreactor (PBR) behavior. This class has several important duties:

  1. Create a ScriptEngine for running JavaScripts
  2. Prep the ScriptEngine by putting the PBR object in the script's bindings and running the PBRHeader.js script file
  3. Hold and run the script file chosen by the user
  4. Cleanly handle a change in the script file at runtime and the user changing which file to use through teh GUI
  5. Call the appropriate functions from the script file in responce to incoming data from the PBR.
  6. Save and load the state of the script file for interruptable execution

Copyright Owner: Michigan State University, license number TEC2011-002101Prov


Field Summary
static java.lang.String TAGNAME
          XML tag for saving configuration
 
Constructor Summary
ScriptManager()
           
 
Method Summary
 void dataReceived(PBRDataEvent data)
          This method is part of the DataEventListener interface.
 void loadConfig(org.w3c.dom.Element scriptTag)
           
 org.w3c.dom.Element saveConfig(org.w3c.dom.Document owner)
          

Note that the values of global variables in the script will not be saved in the configuration, but can be saved and loaded using the provided utilities.

 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

TAGNAME

public static final java.lang.String TAGNAME
XML tag for saving configuration

See Also:
Constant Field Values
Constructor Detail

ScriptManager

public ScriptManager()
Method Detail

dataReceived

public void dataReceived(PBRDataEvent data)
This method is part of the DataEventListener interface.

Specified by:
dataReceived in interface PBRDataListener
Parameters:
data - Data sent from the PBR. Use the getMeasurementType() method to find out what kind of data it is.

saveConfig

public org.w3c.dom.Element saveConfig(org.w3c.dom.Document owner)

Note that the values of global variables in the script will not be saved in the configuration, but can be saved and loaded using the provided utilities.

Parameters:
owner -
Returns:

loadConfig

public void loadConfig(org.w3c.dom.Element scriptTag)